package com.cxs.handle;

import com.cxs.anno.MqttService;
import com.cxs.anno.MqttTopic;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;

/**
 * MqttTopicHandler
 */
@MqttService
@Slf4j
public class MqttTopicHandler implements MqttHandler {


    @MqttTopic("test/#")
    public void testA(Message<?> message) {
        log.info("testA=" + message.getPayload());
    }

    @MqttTopic("topic/+")
    public void test2(Message<?> message) {
        log.info("topic: {}, payload: {}", message.getHeaders().get("mqtt_receivedTopic", String.class), message.getPayload());
    }

}